<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<div class="head_course" style="background-color:#A5C4E3">กระดานข่าว</div>
<table align="center" class="discussion" style="width:100%">
  <tr>
    <th colspan="2">Forum</th><th>กระทู้</th><th>ตอบ</th><th>ตอบล่าสุดเมื่อ</th>
  </tr>
  <% @forums.each do |forum| %>
    <tr>
      <td></td>
      <td><%= link_to forum.forum_name, {:action => 'view_forum', :id => forum}  %></td>
      <td align="center"><%= Topic.find(:all, :conditions => {:forum_id => forum.id, :status_flag => 'Y'}).length %></td>
      <td align="center"><%= Answer.find(:all, :conditions => {:forum_id => forum.id, :status_flag => 'Y'}).length %></td>
      <td><%= begin Answer.find(:first, :conditions => {:forum_id => forum.id, :status_flag => 'Y'}, :order => 'create_on desc').create_on.strftime("%d/%m/%Y %I:%M%p") rescue "" end %></td>
    </tr>
  <% end %>
</table>
